package com.han.demo3.after;

/**
 * @ClassName Computer
 * @Description 计算机类
 * @Author duoduo Han
 * @Date 2024/6/2 14:50
 */
public class Computer {
    private HardDisk hardDisk;
    private Memory memory;
    private Cpu cpu;

    public HardDisk getHardDisk() {
        return hardDisk;
    }

    public void setHardDisk(HardDisk hardDisk) {
        this.hardDisk = hardDisk;
    }

    public Memory getMemory() {
        return memory;
    }

    public void setMemory(Memory memory) {
        this.memory = memory;
    }

    public Cpu getCpu() {
        return cpu;
    }

    public void setCpu(Cpu cpu) {
        this.cpu = cpu;
    }

    //运行计算机
    public void run() {
        System.out.println("计算机正在运行...");
        cpu.run();
        memory.save();
        hardDisk.save("数据");
    }
}
